package C;

import java.util.Arrays;
import java.util.Scanner;

public class C35 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int max = sc.nextInt();
        sc.nextLine();
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        System.out.println(getResult(nums,max));
    }

    public static int getResult(int[] nums,int max) {
        int left=0,right = nums.length-1;
        Arrays.sort(nums);
        int group = 0;
        while(left<=right) {
            if (left==right) {
                group++;
                System.out.println("3");
                break;
            }
            if (nums[left]+nums[right]>max) {
                group++;
                right--;
                System.out.println("1");
            } else {
                left++;
                right--;
                group++;
                System.out.println("2");
            }
        }
        return group;
    }
}
